Bug fixes.

Fixed "Cannot call toString() of undefined" error.
Removed querying on each keyup because it is slow.