Remove dependency on Promise.cast