clean up error handling in filesystem