Pre-github smowton patches

* Replace mate-lookup data structure
* Don't blank skipped.gtf in ref-guided mode
* Fix undefined behaviour and possible deletion of reference scaffolds