fixed potential null pointer exception