Fix bug for reading single attribute from database