Fix notice and warning from  being undefined