more bug fixes, change insertion to db only when post is opened