Fixed main crash