improve errors catch and comments