Fixed a few bugs with scalars