SFTP: fix an issue with the stat cache

Fixes #402 . I'll add a unit test for this issue in another PR. Let's just get this issue fixed in master asap