Integrated patch from original_version branch