Fixed the error checking!