cleaning before getting to the key listener