export mouse/keyboard routines and fix some bugs