bug fixing. still buggy...