Added dep-tests. Fixed some of the bugs (not all).