Miscellaneous corrections and fixes