More math fixes