Enable FPS mode

Copy code from http://nghiaho.com/?p=1613