Fix Clang static analysis errors

This covers #459 and #460.
It's because pos is the variable that's causing the dead store.