added assertions
fix V8 segfault