Rearrange some EC stuff to be bound to the right ifdefs. fixes #900