fixes for as.scalar