Fixed dependencies and some bugs