add support for Patch
fix unit tests