bug fix perfomance optimation