Fixes

* History not being erased on enter
* History could be filled with undefs
* Incorrect placement of cursor