Some miscellaneous fixes