added methods for errors checking