Fix for #1319 including tests