expanded tests and fixed return codes