added safety check in get_xxx_buffer to verify arrayref before join