type conversion code consolidated
sqlite type selection fixed