Fixed issues with unit selection and database calls