Fixes #1169
Also fixes a bug caused by card images.