fixes + improvements + more safety