Some fixes (Thanks BlackXT)