Fixed most if not all of the crashing errors