Fix 315: insert/select

This is to fix #315