Made API respect sleep mode.