Fixed a bug on output