fixed compilation warnings (unused vars, uninitialized vars, discarding volatile)