added a date type to sg-schema + various bug fixes