Removed buffer cast, checking for str as well