Bugfix and Clean() routine