Fix for #440, #439, #438