fixed implementation of union