bug fixing (not finished)