Moved tests from dep-mgmt and fixing bugs