unify Cavendish with GMO, fix syntax errors

Due to some unset variables, Cavendish often throws javascript syntax errors. This is fixed with proper checking of each one before using. This also makes this skin behave more like GMO does. With luck this may fix WikiEditor working on GMO but not Cavendish.