added #ifdef _DEBUG around LOG(DEBUG) calls