Fix Clang static analysis errors

This covers #459 and #460.
This should work since the variable is used after the store.