Added error checking to library.sh.