formats and fixes a possible npe