fixed loading sanity check
added own error handler to avoid caja