fix bug on deleting attribute
support opening files with mode='r' or 'rb'