Fixed Preconditions check in retain().
Changes from review.