Quick bug fix to deal with NPE.