fixed hopefully some final bugs