fixed gcc warnings and some pointer issues thanks to hunz