some bugs corrected
Small bugs adjusted