Bug fixes for Stage3D