Solved some bugs and compiler issues with gcc.