Fixed gcc warnings, some little mistakes, added compatibility macros