I think the problem comes from calling WP_filesystem incorrecly, but I can't find how to make it work
This is a tad over my head, but does anything here look at all helpful?
http://codex.wordpress.org/Filesystem_API
There's an external reference link at the bottom of that page, as well.