add ref and out checks

fixes #2
fix release build