fix resize bug
add support to change aggregation function