fixed a bug where key detection would stop on null