serendipitously

adverb

By serendipity; by blind luck in combination with wisdom; by fortunate accident.