Merge the bug #4683 and fix conflicts