leaves bug fix