set max fps and fixed a bug