Fix Alter query

Fix alter query as per bug #4 fixes proposed by dgmdan