Bug fixes and miscellaneous updates