Fixed null pointer error and improve debian packaging.