fix problems for non-trivial types, add support for std::vector