Fix insertion checks
Fix other libs as well
Merge pull request #42 from ozh/is_insert

Var $is_insert not correctly defined