bug fixed and other improvements