fixed some legacy code