main bug fix