updated to output error to console