support require api. Fixes #641