fixed bug when printing (corner case)