Better handling of separate shader

And fixed a bug when non-separate shader used