added panic check