Running Management Console script throws a RuntimeException error