Fix notice errors by reworking exists check
5.0.4