Fixed numerous issues that caused errors in clang