Fixed the wrong id bug and some more crashes and comments