Added null handling, still broken though