Fixed null reference when adding dependencies