Added check for on load

Hopefully prevent the stack error I see sometimes