Added handeling of undefined values in position function
Merge pull request #3 from brunoduran/master

Fix to the position function