bug fix patch by BCNC