Bugfixes and workaround for sporadic unpack linking error.