Fixed undefined variable 'creds' and made some minor changes to filesystem API usage