Fixed null pointer when pressing enter