How can I get my compass pointing the right direction? On my Samsung Galaxy S2 running ICS 4.0.4, my compass is off by 90 degrees. It shows west in the north position.

I had a similar compass problem before, and had solved it by applying this patch. Unfortunately, I've since discovered that this patch breaks my WiFi.

I have tried calibrating the compass by moving the phone in a figure 8 pattern, as well as rotating on all axis. The compass is still pointing the wrong way, though.

Is there a safe solution for fixing my compass?
Rotating around each axis clockwise then counterclockwise got the compass working on my Samsung Galaxy Victory. This particular phone's compass works correctly with the phone flat or upright.