Fix possible crashes and some spacing errors.