fix bug of not accepting --level 0
clean unused functions