Fixed JS timer bug