Fix bug in constant type checking