misc fixes from 9c5c3e8