Minor math fixes