add logging for error checking