More shader generation, several bugfixes