Fix some arithmetical errors

Can I change all asserts?