A few bug fixes

Hi there , this is Chris Turnbull from the forums.

I've noticed a few things that often break/crash when I'm testing TinyMCE, so I'd like to suggest a few fixes.

I'm sorry if I've not requested this properly, I'm a bit new to github and the whole forking/pulling things.