Added fail() and use it to print helpful error messages.