fixed bug in doing output