Fixed main crash
Just some fixing