Fixed program bugs