fixed erroneous output