Fixed bug in spikem code