Model handling fixed

Signed-off-by: Thomas Schubert <funthomas424242@gmail.com>
refactored

Signed-off-by: Thomas Schubert <funthomas424242@gmail.com>