fixed bug in getCoordinates