finally bugs fixed