Fixing APEX initialization