add the missing code and fix failing spec that got lost in the merge