Use .get instead of []
Fix minor bugs