Fixed bugs that appeared when building with gcc