Problem solved. There is an option in Universal Access Preferences called "Press and hold keys to accept them (slow keys)". Somehow, that was checked. When I unchecked it, it started working again. I guess accidental pressing of h key must have caused it.