fix spec copy bug reported by flxb and add unit test