Adds add_component testcase and corrects related bug