Grain boundary states and the characteristics of lateral polysilicon diodes