Compilation on squeeze

+ fixes for compilation with g++4.4 available on squeeze
+ mostly added type conversions