change empty offset to 0 and fix failure when attempts is not set