Fixed a few misplaced lines that caused crashes