Fix nil ref, formatting