added global context clearing in layer initialization