This check appears at several locations - might be refactored to an dedicated function