bug fixing get closest position