allow KeyValueContainer objects to be passed as key-value arrays

fixed issues described in #255