A couple of small performance tweaks

Found using valgrind
This is only the tip of the iceberg