fixed ff-console null errors w/ if(!null) wrappers

I added a couple if() wrappers around lines that have been showing up as errors in the firefox browser-console. I'm not sure why these were happening in the first place, but the workaround is simple and only touches lines that were failing anyway. Maybe somebody more familiar with the source can check if the error this is hiding is actually relevant.

This is a workaround for this issue mentioned in the forums:
    http://forums.chrispederick.com/discussion/386/document-getelementbyid-is-null-7333