Fixed main bug