Bug fix. Minor code cleaning