fix block null pointer exception