Fixes for shifting logic