#782 bug fixing