Safe build

Issue #158