Prevent unsupported operand type(s) for +: 'int' and 'NoneType'