General final bug fixes