handle library directories without trailing slash
rng fix