Add patch support

For some weird reason it fails on #499. Care to help out to land this?