Fix require bug and add specs