Several bug fixes regarding constants