Various patches, please review