Add checks to prevent PHP equiv. of NPEs