Fix issue #2335 on master