added more robust behaviour and Release compilation