Misc. bug fixes and changes.