Fixes to compass calculations