Constructor with parameter checked