fixes problems in  method definition locating function