Fixed a bug in updating the current frame