fixed segfault issue. fiddled with includes and forward declarations