Fixes #5630 and Fixes #5629