Fix background detection