Remove references when deleting empty stylesheet, fixes #333