fixed crashes and weird broken lifecycle