reconstruct code to fullfill auto test