fix some styling issues and bring img/dir grid rendering code more in sync