finishing test functions and fixing change test mode bug