fix some bugs with provides implementation