fix variable size
fix compiler warnings and ugly static variables