Fixed UpdateX() and UpdateZ() Mathmatical Errors

This should make the code more reliable than before.