more reliable way of importing PIL (#2000)