Fixed crash and indentation

Gonna think twice before accepting another pull request