Fix commands by correctly ordering dependencies