Bug and behavior fixes