bug fixed and docs improved