A proper fix for #540/#515