Check for null and bind keydown

When I remade my pull request, it didn't include the $document.bind line.. kind of strange.
Also, I forgot to check for null errors if the client used tab excessively.