improving phantom tp introduction and eliminating non necessary NOT NULL
expressions