corrected quite big bug