Fix handling of constants

Close #113