Added bounds checking for config file parsing