added compatibility with AMD style js