some fix and enhancement