Copy on write
Small fixes

Just a few things clang -Weverything complains on