merge with edrian
fixed db issues