Fixed bug from r308 and r310