Fixed vqa crashes

Fixes #4224.