Fixing file locking errors and bug with long names.
Merge