set defined dependencies and fixed some bugs