Fixed messages and added checks

Fixed messages and added error checks. (Hope this works.)