added error handling for require.js