Fixes for bug #6125