Fix site deletion

Fixes some problems in #555 when deleting sites, including a crash and some visual weirdness. Small code cleanup as well.