Fixed bugs in proxy generation

Fixed bugs when generating proxies for bool. DateTime, DateTime?.
Also wrapped up a few tests around this part of the code... Should be
easier to fix new bugs from now on. closes #302 closes #303