Just changed some error checking stuff