Use the correct mode for a few file types, add a missing require