Fix unused variable warning (#245)

Fix and add asserts