Bug Fix

some bugs fixed