minor bugs corrected