Fix various bugs and wrong Exception classes to get mspec passing