fix bug and add code to check box