fix bugs and put option into buffer instead of db