Fix plugin detection

This fixes #1043