additional warnings
fix wait twice
fix some warnings
applied Ralf's pintos patch to avoaid false warnings