Fix some miscellaneous NPEs