Attachment pages stealing page slugs

I’ve found a workaround if someone has the same problem:

In the database, you can search for the attachment page that’s causing problem, you’ll find it in wp_posts by searching for its post_name (which is the slug you want). Then just rename that post_name (in about-img for example). It isn’t a fix but it will make the desired slug available for your page’s URL.