Typecast and PHP Warning improvements