Fixed errors from previous version

Latest version had errors which needed fixing