test function added for debug mode