Support AMD and global for the client. fixed #16