Added error-logging