assorted fixes based on @patrickkettner review