pull in changes from 4.2 branch / fix errors