fixed test run issue and add tests