fixed bug in construct and query