avoid nil pointer in prefix generation