Adapted fix for webkit based browsers