Initial implementation of locks
Fixed truncate