Modified code for check sequence issue