Rework configuration validation to fix #461

A fix for the PR #461 
Thank to @alexander-orabey and sorry for the mistake