Minor bug fixes and corrections