Fixed write to suport empty uploadDir parameters
Added write tets
Changed test setup