Applied changes made by https://github.com/movabletype/movabletype-addons/commit/1bb8016869ce746afb218bf35c787e90f899027a