fix many BUGS