added awaitReady to avoid nullPointer exceptions