Fixed segfault, generally cleaned up handling of transform spec