fixed require.js to work within render functions