Fixed NPE's if running in the editor.