Fixed issue where values from database weren't being retrieved properly