javascript bug fixes and namespace change