fix errors in joins