fix some clang static analyze warnings/errors:

thanks det!