GPIO 0 is special. On the LoLin it is driven by a decoded RTS/DTR signal and is used to put the device into and out of programming mode. Of all of the GPIO pins, it should be your last choice to use for some other purpose.