some fixes & coding style