Added console log for error