fixed erroneous legacy code