Fixed Legacy Code errors