added checks on int bounds