fixed another NPE. still infinite looping though.