avoiding opersations that result in python internally raising an error