Fixed some errors noticed by Alexander Lagoda