more bug fixing and testing