use a better way to deal with key-up