corrected some legacy code