Test for #4523 and #4536