Fixed a looping-bug