Fix some bugs with null key commands. Start refactor of fileManager.js.