Fix some arithmetical errors