Fix #522 part  1