Fixed possible bit shifting problem when shifting more than size of type