Fix bugs, add dependency