Fixed error checking before the characters are loaded.
Fixed code formatting.