fixes for AS7-6010 and AS7-6678

https://issues.jboss.org/browse/AS7-6678
https://issues.jboss.org/browse/AS7-6010