fixed bugs with updating mesh every frame