Added error checking code to common library.