Fixed flickering sprite issue.

The final frame should be total - 1 apparently.