Remove Warnings and Fix Minor Bugs