Added security for allocation of class instances.