Fixed database entity objects
fixed some issues with tests