Fix exceptions, splitlines and file_type when None

Signed-off-by: Ruben Sanchez <ruben.flex@gmail.com>