Added conversion to int while checking out of range