Fixed minor problems which gave problems and some stuff that might be a problem later (which still need right code)