Fixing intermittent test failures in APEX