Fixed some Bugs and added -pthread to Make