fix for issue #129

$sim variable was not defined; a brace was missing