Incorporated Ajit's fix (commit 4585a85)