Added and fixed bugs for flow deployment and enabling in tests