Fix for NPEs on startup

Looks like there were some XUL optimizations made. The null pointer occurs because a method is invoked on a document object that is not assigned. I fixed the method call to use the right document object and PAD now behaves as expected.