Fix undefined PHP variables bug