FDRA: Fault detection and recovery algorithm for wireless sensor networks