merged fix for some issues