more fixes for file-api-mode. seperated logic from localStorage