Updated from commit 4b170b303af62d93c193c2167e3dc162e6244eb7.