Fix legacy code