bug fix for null pointer exception