Fixed the crashes