add readonly mode and minor change