Fixes build issues because of generics and exceptions.