small bug fix and ehancement