Improve patch compatibility, as suggested by Philipp Janda