Why does my sketch only work when Serial command is active?