fix for coordinate out of range access