Add require file feature and fix some bugs