fixed error when r.js was used