Replaced incorrect variable by correct one.
Bug fixes.