Fixed a typo (self instead of $self).
Made error message clearer.