bug fix and backend optimization