Improve thread-safety of overlaying NIFs