Soem bug fixes