got it working in browser

fixed some bugs regarding browserify.