Patch to protect against apparent GCC bug
Small bug fixes