assorted bug fixes