Bugfix and remove commented code