only prevent default when necessary