replicate https://github.com/strongloop/loopback/issues/887