several minor changes
fixed several bugs