Fix query never being called
Fix wrong sql in the test on delete
Show the top link in the correct place