add main function and fix print bug