Updated various little bug fixes caught by code spotter