Fix static build and add regession test