checking for onChange before mounting