fix spike generation