Change object directory detection logic. Use derived directory instead of hardcoded value