Working to #2571, fixed issue #2599