[CORE] Correct in/out computation