Bugfix

Fixed some missing variables and correct two alert errors.