bug fixed for spnutils.py