fixed testing of code when main method