minor fixes, tested, works