make compatible with node and AMD