fixed bug with adding to db