Fix some compil warnings and Debug assertions
Fix some compil warnings and Debug assertions.