changed data types to avoid -Wtype-limits #655