Patch bug fixes