did some bug fixing