fix NullPointerException in keyboard hack