Fixes for connections in APM pilot code.