Fix location jumping for non-ints

- also clean up some code duplication