WIP: dwnsampling is fixed
WIP: fix segfaults