fix compilation and other minor bugs...