added changes from 997ff67