Fixing Ryan's errors for empty strings