fixed a bug in the hide function