fixed fatal bug in comparing different types