Final fixes for #1240, #1234