a bug in the output fn