fixes and a bit of cleanup for store_file