fixing allocation on database