Fix dispose handling in scan and join