In general, debugging custom code is beyond the scope of what we can help with on the forum. When posting code it's best to create the simplest possible example that can be run directly and reproduces the issue. See the guidelines for
posting Vizard code for more information.