Apply patch from petschki's which fixes #12440

I reopened the ticket because i could reproduce in 4.3rc1.