fix bug in locate method