[WFLY-2942], [WFLY-3012] some patching bug fixes

https://issues.jboss.org/browse/WFLY-2942
https://issues.jboss.org/browse/WFLY-3012: