Fix for crash when using relative dimensions and relative positioning

When I tried to position an element in relation to another, the app crashes when relative dimensions are used.
This should fix it. See attached test cases for an example