fixed to handle basic errors.