Added exceptions
Throw error if SGL is not initialized