some bug fix and improves