add base code from 1.0.5