Fix from 4.0 branch: https://github.com/bigtreecms/BigTree-CMS/issues/109