fixed a few stability issues