Fixed loop-bug