Store output pubkeys separately, bug fixes