Combination of bug fixes and contributions by @stolen

Fixed one if branch that may result in uninitialized position variable