Update library.cpp

Fixed a minor bug which would occasionally cause a crash.