added some errorhandling and passthrough flag