fix capture logic