promise working as expected