Fix #3845 plus #4403