added some addtional safety checks for valid values of framerate.