Bug/check certificate

Fixes #437