doc update and code fixing