More pythonic fix

I tested the change but not the whole program.