bugs fixed, may be logical errors!