When you said you were not using a crystal I got to thinking resonator.
You can use HS mode, OSC2 will just be an open pin.

As for your problem I am at a loss.
Maybe there is something at the beginning of your code messing things up?