adapted for Promises/A+ v1.1.0