fixes #3097 - foreign key error on deleting trend