fixed time bug
added loop per second variable