defer promise fix
add defer test