Manually added snooc's pull request #24