Fixes issues for #4303

This basically involves fixing the stuff in issue #4303

Fixes #4303
*insert baby jesus crying here