improved partition detection