Customization of an Arduino library on Github

"OUTPUT" has nothing to do with the state of the pins, it is the direction. A pin has to be OUTPUT in order to control your relay by setting the pin to either "HIGH" or "LOW".

When the board resets, the pins return to their default state during boot. Some pins are "HIGH" by default, others are "LOW". Your problem may be solved by simply finding a pin which has "LOW" as its default state.

You should also find out what the cause of the occasional reset is. This may be caused by a WatchDog (hanging code) or by a hardware issue. If it is a hardware issue, your device may break at some point, so worth to investigate.