fixed bug in constructing given