fix timer bug

1. fix a bug in timer
2. some test code for timer