added auto new line support & fixed initial hook calling