Miscelaneous minor changes and bug fixes