fix locating code