Fix for #544, #485