fix for null pointer exception