fixes for WFLY-3008 and WFLY-3000

https://issues.jboss.org/browse/WFLY-3008
https://issues.jboss.org/browse/WFLY-3008