Fixed an error with the height being not set
Fixed a logic error in selecting a x/y position