Major bugs fixed