Fix bug in getGlobalPosition() method