fix bug mentioned by rubyrajesh