update to latest apex (my changes were removed, need to reimplement)