switched two lines in request animation frame