partial fix for #7 (still not completely done)