Fixes for issues #344 and #348 (scalar behaviour)