Bugfix and modify output