Fixed empty/crashing template
Restrict input device descriptor

Fixed #768