Fixed legacy code bug