Fixed a bug: self not defined