Added error checking for open lib.