Added a error function, useful for debugging.