make library type safe (kind of)