updated documentation and fixed bugs on patching