Bugfix: infinite loop