modify some ugly codes