Fix deprecation and compiler warnings
Fix broken exception messages in tests